function [residual, T_order, T] = dynamic_resid(y, x, params, steady_state, T_order, T)
if nargin < 6
    T_order = -1;
    T = NaN(16, 1);
end
[T_order, T] = P30ra.sparse.dynamic_resid_tt(y, x, params, steady_state, T_order, T);
residual = NaN(10, 1);
    residual(1) = (T(1)*T(4)) - (params(2)*y(15)^params(7)+T(5)*T(6));
    residual(2) = (T(6)+T(9)*T(10)) - (T(12)*(1-params(3)+params(4)*T(10)));
    residual(3) = (y(20)) - (params(6)-params(8)*(y(11)-params(9)));
    residual(4) = (y(12)+y(14)) - (y(11));
    residual(5) = (y(11)) - (T(13)*exp(y(17))*T(14));
    residual(6) = (y(14)) - (y(13)-(1-params(3))*y(3));
    residual(7) = (y(16)) - (y(11)/y(15));
    residual(8) = (y(17)) - (params(5)*y(7)+x(1));
    residual(9) = (y(18)) - (T(14)*T(15)-params(3));
    residual(10) = (y(19)) - (T(13)*(1-params(4))*T(16));
end
